package com.gxuwz.medical.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import com.gxuwz.medical.domain.policy.Policy;

public class PolicyDao extends GenericDao<Policy> {
	protected Policy handle(ResultSet rs)throws SQLException{

		Policy entity = new Policy();
		entity.setPlimit(rs.getDouble("plimit"));
		entity.setRate(rs.getString("rate"));
		entity.setPyear(rs.getString("pyear"));
		entity.setStatus(rs.getString("status"));
		
		return entity;

	}
	
	/**
	 * 查询当前执行年度下的信息
	 */
	public Policy queryPolicy(){
		String sql = "select * from t_policy where status = 1";
		Object[] params={};
		try {
			List<Policy>policyList = super.queryOjects(sql, params);
			if(policyList!=null && !policyList.equals("")){
				return policyList.get(0);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}

}
